/**
 * 回复 审核 已回复
 * @author zhangqiang
 * @date   2016/10/08
 */
import Swiper from "../components/Swiper";
import LargeImg from '../components/LargeImg';

(function (lf, r) {

    var RC = r.createClass,
        ajax = lf.utils.ajax,//全局
        getUrlParam = lf.utils.getUrlParam,//获取自定义url
        doAction = lf.bridgeJs.doAction;//跳转
    const EVENRID = getUrlParam('eventId'),//报事id
           TYPE = getUrlParam('type'),//根据url不同类型显示不同页面
           ORDERID = getUrlParam('orderId'),//对应工作流实例ID
           ID = getUrlParam('id'),//待审核页面发送数据需要主键ID
           LAST = getUrlParam('last'),//根据last判断跳转方法
           REVIEWSTATUS = getUrlParam('reviewStatus'),
           textStatus= REVIEWSTATUS == 1?'待审核':REVIEWSTATUS==2?'审核通过':'',
           review = REVIEWSTATUS==1?'status':REVIEWSTATUS==2?'statusNo':'',
           CONFIRM = 'CONFIRM',
           FEEDBACK = 'FEEDBACK',
           CHECK = 'CHECK';

    if (TYPE == CONFIRM) {//待回复
        var Add = RC({
            getInitialState: function () {
                return ({
                    len: {},
                    add: {},
                    waing: [],
                    largeImgSrc: '',
                    largeImg: '',
                    imgList: [],
                    isShow: false,
                })
            },
            componentWillMount(){
                var me = this,
                    user = me.props.user;
            },
            enlargeHandler:function(src) {
                this.setState({largeImgSrc: src});
            },
            render: function () {
                var init = this.props.data,
                    pics = [],
                    me =this,
                    fmt = 'yyyy-MM-dd hh:mm',
                    reportTime = lf.utils.format(init.reportTime, fmt),
                    orderTime = lf.utils.format(init.orderTime, fmt);

                if (init.picUrl != undefined)
                    pics = init.picUrl.split(',')
                return (
                    <div className="box-siz">
                        <div className="title-text">工单信息</div>
                        <div className="img-add">
                            <div className="place tp">
                                    <div className="text-cl">任务描述：</div>
                                    <div className="text-rg">{init.content}</div>
                            </div>
                            <div className="place">
                                <Swiper imgList={pics||[]} enlargeHandler={me.enlargeHandler}/>
                            </div>
                            <div className="place rep">
                                    <div className="text-cl">服务地点：</div>
                                    <div className="text-rg">{init.location}</div>
                            </div>

                            <div className="place">
                                    <div className="text-cl text-lf">联系人：</div>
                                    <div className="text-rg">{init.reporterName}</div>
                            </div>
                            <div className="place">
                                    <div className="text-cl">联系电话：</div>
                                    <div className="text-rg">{init.phone}</div>
                            </div>
                            <div className="place">
                                <div className="text-cl">预约时间：</div>
                                <div className="text-rg">{orderTime||'无'}</div>
                            </div>
                            <div className="place">
                                <div className="text-cl">报事时间：</div>
                                <div className="text-rg">{reportTime||'无'}</div>
                            </div>
                            <div className="place">
                                <div className="text-cl">反馈内容：</div>
                                <div className="text-rg">{init.result||'无'}</div>
                            </div>
                        </div>
                        <LargeImg src={me.state.largeImgSrc}/>
                    </div>
                )
            },
        });
        var List = RC({
            getInitialState: function () {
                return ({
                    menu: '',
                })
            },
            render: function () {
                var infn = this.props.data,
                    resAdd = this.props.res,
                    hi = this.props.hi,
                    fmt = 'MM-dd hh:mm';

                let list = resAdd && resAdd.map(function (info, i) {
                        var Time = lf.utils.format(info.acceptTime, fmt);
                        let arr = info.currAccepterName && info.currAccepterName.split('--');
                        let n = arr && arr.length - 1;
                        var textName;
                        if(resAdd[i].taskDisplayName == "派单"&&resAdd[i].status == '1'||resAdd[i].taskDisplayName == "派单"&& resAdd[i].status == '2'){
                                textName = '派单中'
                        }else if(resAdd[i].taskDisplayName == "派单"&& resAdd[i].status == '3'){
                            textName = '已派单'
                        }else if(resAdd[i].taskDisplayName == "派工"&& resAdd[i].status == '0'||resAdd[i].taskDisplayName == "派工"&& resAdd[i].status == '1'){
                            textName = '派工中'
                        }else if(resAdd[i].taskDisplayName == "派工"&& resAdd[i].status == '2'||resAdd[i].taskDisplayName == "领导审核"&& resAdd[i].status == '2'||resAdd[i].taskDisplayName == "客服回访"&& resAdd[i].status == '2'||resAdd[i].taskDisplayName == "办理"&& resAdd[i].status == '2'){
                            textName = '已退回'
                        }else if(resAdd[i].taskDisplayName == "派工"&& resAdd[i].status == '3'){
                            textName = '已派工'
                        }else if(resAdd[i].taskDisplayName == "办理"&& resAdd[i].status == '0'||resAdd[i].taskDisplayName == "办理"&& resAdd[i].status == '1'){
                            textName = '办理中'
                        }else if(resAdd[i].taskDisplayName == "办理"&& resAdd[i].status == '3'){
                            textName = '已办理'
                        }else if(resAdd[i].taskDisplayName == '领导审核'&& resAdd[i].status == '0'||resAdd[i].taskDisplayName == '领导审核'&& resAdd[i].status == '1'){
                            textName = '领导审核中'
                        }else if(resAdd[i].taskDisplayName == "领导审核"&& resAdd[i].status == '3'){
                            textName = '已审核'
                        }else if(resAdd[i].taskDisplayName == '客服回访'&& resAdd[i].status == '0'||resAdd[i].taskDisplayName == '客服回访'&& resAdd[i].status == '1'){
                            textName = '客服回访中'
                        }else if(resAdd[i].taskDisplayName == "客服回访"&& resAdd[i].status == '3'){
                            textName = '已回访'
                        }

                        return <div key={i} className={"tpd-row "+(hi?'show':'')}>
                                <p className="tpd-left-con">
                                    <i className={resAdd.length==i+1 ? 'hid':''}></i>
                                    <span className="task-processing-name">{arr && arr[n]}</span>
                                    <span className="green">{textName}</span>
                                </p>
                                     <p>{Time||''}</p>
                              </div>
                         })
                        return (
                            <div className="detail">
                                {list}
                            </div>
                )
            }
        });
        var Body = RC({
            getInitialState: function () {
                return ({
                    len: '',
                    add: '',
                    resList:'',
                    waing: [],
                    isShow: false,
                    processorList: [],
                    nextOperator: '',
                })
            },
            componentWillMount(){
                var me = this,
                    user = me.props.user;

                //if (ORDERID && ORDERID != 'undefined') { //orderid返回undefind就不调用这个接口
                ajax({//上部分相片到历史列表
                    type: 'post',
                    data: {
                        eventId:EVENRID,
                    },
                    success: function (res) {
                        me.setState({
                            add: res.data
                        })
                        ajax({//审核人选项
                            type: 'get',
                            data: {
                                projectId: res.data.projectId,//projectId
                            },
                            success: function (data) {
                                if (data.code != '200') return;
                                let dataList = data.dataList;
                                me.setState({
                                    processorList: dataList.map(function (data, i) {
                                        return <a key={'person-'+i} className="mui-btn text-dot"
                                                  data-id={data.staffList[0].id}>{data.staffList[0].name}</a>
                                    }),
                                })
                            }
                        }, '/api/work/event/getDepartmentDirectorList')
                    }
                }, '/api/work/event/getEventReport')//获取报事详情

                ajax({//第一级菜单待回复列表下面问题和回复列表，待审核列表
                    type: 'post',
                    data: {
                        eventId: EVENRID,
                    },
                    success: function (data) {
                        me.setState({
                            len: data.dataList
                        });
                    }
                }, '/api/work/event/getEventConsultList')

                if(ORDERID && ORDERID != 'undefined'){
                    ajax({//上部分相片到历史列表
                        type: 'get',
                        data: {
                            orderId:ORDERID,
                            staffId: user.id,
                        },
                        success: function (file) {//工单历史流程
                            console.log(file);
                            me.setState({
                                resList: file.data.eventProcessList
                            })
                        }
                    }, '/api/work/event/getEventReportDetail')//获取工单详情
                } else {
                    me.setState({
                        isShow: true,
                    })
                }
            },
            componentDidUpdate: function () {
                var persons = r.findDOMNode(this.refs.personBox).getElementsByTagName('a');
                var me = this;
                $.each(persons, function (i, item) {
                    var $me = $(this);
                    $me.on('touchstart', function () {
                        $me.addClass('active').siblings().removeClass('active');
                        var nextOperator = $(this).data('id');
                        me.state.nextOperator = nextOperator;
                    });

                    if (i == 0)
                        $me.trigger('touchstart');
                });

            },
            btnfile: function () {
                var next = this.state.nextOperator,
                      me = this,
                    user = me.props.user;
                if ($('.required').val() == '') {
                    alert('请填写回复内容')
                    return false
                }
                ajax({//点击发送内容
                    type: 'get',
                    data: {
                        eventId: EVENRID,//报事id
                        content: $('.required').val(),//内容
                        staffId: user.id,//员工id
                        reviewStaffid: next,//审核人id
                    },
                    success: function (data) {
                        //if (data.code != '200') return;
                        if(data.code == '200'){
                            if(LAST == 'fn'){
                                alert('提交成功',()=>{
                                lf.bridgeJs.doClose();
                            });}else{
                                alert('提交成功',()=>{
                                    var CONFIRM = 'confirm';
                                    lf.bridgeJs.doLocation('report-reply.html?type=' + CONFIRM, '待回复');
                                });

                            }

                        }else if(data.code == 'EVENTCONSULT_NOT_CHECK'){
                            if(LAST == 'fn'){
                                alert(data.desc,()=>{
                                    lf.bridgeJs.doClose();
                                });
                            }else{
                                alert(data.desc,()=>{
                                    var CONFIRM = 'confirm';
                                    lf.bridgeJs.doLocation('report-reply.html?type=' + CONFIRM, '待回复');
                                });
                            }

                        }
                    }
                }, '/api/work/event/replyEventConsult')

            },
            render: function () {
                var data = this.state.add,
                    resMy = this.state.resList,
                    inti = this.state.len,  //1待回复 2回复
                    fmt = 'yyyy-MM-dd hh:mm';
                console.log(this.state.isShow);
                var file = inti && inti.map(function (infn, i) {
                        var Time = lf.utils.format(infn.createTime, fmt);
                        if (infn.status == 1) {
                            return <div key={i} className="priv">
                                    <div className="line undefined"><div className="text-cl line-title">咨询时间：</div><div className="line-content">{Time}</div></div>
                                    <div className="line undefined"><div className="text-cl line-title">咨询内容：</div><div className="line-content">{infn.content}</div></div>
                                 </div>
                        }else if (infn.status == 2) {
                            return <div key={i} className="priv">
                                    <div className="line undefined"><div className="text-cl line-title">回复时间：</div><div className="line-content">{Time}</div></div>
                                    <div className="line undefined"><div className="text-cl line-title">回复内容：</div><div className="line-content">{infn.content}</div></div>
                                  </div>
                        }
                    })

                return (
                    <div className="box-mic">
                        <Add data={data} />
                        <List data={data} res={resMy} hi={this.state.isShow}/>
                        <div className="reflex">
                            {file}
                        </div>
                        <div className="text-box">
                            <textarea name="headContext" cols="30" rows="10" className="required"
                                      placeholder="请输入"></textarea>
                        </div>
                        <div className="examine">
                            <p>选择审核人：</p>
                            <div className="btn-mine">
                                <div ref="personBox" className="box radio-wrapper flex-box-row">
                                    {this.state.processorList}
                                </div>
                            </div>
                        </div>
                        <div className="btn-Submit">
                            <a className="btn-put" href="javascript:;" onClick={this.btnfile}>提交</a>
                        </div>
                    </div>
                )
            }
        });
    }

    else if (TYPE == CHECK) {//已回复
        var Add = RC({
            getInitialState: function () {
                return ({
                    len: {},
                    add: {},
                    waing: [],
                    largeImgSrc: '',
                    largeImg: '',
                    imgList: [],
                    isShow: false,
                })
            },
            componentWillMount(){
                var me = this,
                    user = me.props.user;
            },
            render: function () {
                var init = this.props.data,
                    pics = [],
                    me = this,
                    fmt = 'yyyy-MM-dd hh:mm',
                    reportTime = lf.utils.format(init.reportTime, fmt),
                    orderTime = lf.utils.format(init.orderTime, fmt);
                if (init.picUrl != undefined)
                    pics = init.picUrl.split(',')

                return (
                    <div className="box-siz">
                        <div className="title-text">工单信息</div>
                        <div className="img-add">
                            <div className="place tp">
                                <div className="text-cl">任务描述：</div>
                                <div className="text-rg">{init.content}</div>
                            </div>
                            <div className="place">
                            <Swiper imgList={pics||''} enlargeHandler={me.enlargeHandler}/>
                            </div>
                            <div className="place rep">
                                <div className="text-cl">服务地点：</div>
                                <div className="text-rg">{init.location}</div>
                            </div>

                            <div className="place">
                                <div className="text-cl text-lf">联系人：</div>
                                <div className="text-rg">{init.reporterName}</div>
                            </div>
                            <div className="place">
                                <div className="text-cl">联系电话：</div>
                                <div className="text-rg">{init.phone}</div>
                            </div>
                            <div className="place">
                                <div className="text-cl">预约时间：</div>
                                <div className="text-rg">{orderTime||'无'}</div>
                            </div>
                            <div className="place">
                                <div className="text-cl">报事时间：</div>
                                <div className="text-rg">{reportTime||'无'}</div>
                            </div>
                            <div className="place">
                                <div className="text-cl">反馈内容：</div>
                                <div className="text-rg">{init.result||'无'}</div>
                            </div>
                            <div className={review}>{textStatus}</div>
                        </div>
                        <LargeImg src={me.state.largeImgSrc}/>
                    </div>
                )
            },
            enlargeHandler: function(src) {
                this.setState({largeImgSrc: src});
            }
        });
        var List = RC({
            getInitialState: function () {
                return ({
                    menu: '',
                })
            },
            render: function () {
                var infn = this.props.data,
                    into = this.props.resList,
                    fmt = 'MM-dd hh:mm';
                let list = into && into.map(function (info, i) {
                        var Time = lf.utils.format(info.acceptTime, fmt);
                        let arr = info.currAccepterName && info.currAccepterName.split('--');
                        let n = arr && arr.length - 1;
                        var textName;
                        if(into[i].taskDisplayName == "派单"&& into[i].status == '1'||into[i].taskDisplayName == "派单"&& into[i].status == '2'){
                            textName = '派单中'
                        }else if(into[i].taskDisplayName == "派单"&& into[i].status == '3'){
                            textName = '已派单'
                        }else if(into[i].taskDisplayName == "派工"&& into[i].status == '0'||into[i].taskDisplayName == "派工"&& into[i].status == '1'){
                            textName = '派工中'
                        }else if(into[i].taskDisplayName == "派工"&& into[i].status == '2'||into[i].taskDisplayName == "办理"&& into[i].status == '2'||into[i].taskDisplayName == "领导审核"&& into[i].status == '2'||into[i].taskDisplayName == "客服回访"&& into[i].status == '2'){
                            textName = '已退回'
                        }else if(into[i].taskDisplayName == "派工"&& into[i].status == '3'){
                            textName = '已派工'
                        }else if(into[i].taskDisplayName == "办理"&& into[i].status == '0'||into[i].taskDisplayName == "办理"&& into[i].status == '1'){
                            textName = '办理中'
                        }else if(into[i].taskDisplayName == "办理"&& into[i].status == '3'){
                            textName = '已办理'
                        }else if(into[i].taskDisplayName == '领导审核'&& into[i].status == '0'||into[i].taskDisplayName == '领导审核'&& into[i].status == '1'){
                            textName = '领导审核中'
                        }else if(into[i].taskDisplayName == "领导审核"&& into[i].status == '3'){
                            textName = '已审核'
                        }else if(into[i].taskDisplayName == '客服回访'&&into[i].status == '0'||into[i].taskDisplayName == '客服回访'&&into[i].status == '1'){
                            textName = '客服回访中'
                        }else if(into[i].taskDisplayName == "客服回访"&& into[i].status == '3'){
                            textName = '已回访'
                        }

                        return <div key={i} className="tpd-row">
                                    <p className="tpd-left-con">
                                        <i className={into.length==i+1 ? 'hid':''}></i>
                                        <span className="task-processing-name">{arr && arr[n]}</span>
                                        <span className="green">{textName}</span>
                                    </p>
                                    <p>{Time}</p>
                               </div>
                    })
                return (
                    <div className="detail">
                        {list}
                    </div>
                )
            }
        });
        var Body = RC({
            getInitialState: function () {
                return ({
                    len: '',
                    add: '',
                    waing: [],
                    resList:'',
                    isShow: false,
                    processorList: [],
                    nextOperator: '',
                })
            },
            componentWillMount(){
                var me = this,
                    user = me.props.user;
                ajax({//第一级菜单待咨询回复列表下面问题列表
                    type: 'post',
                    data: {
                        eventId: EVENRID,
                    },
                    success: function (data) {
                        me.setState({//state 1待回复 2回复
                            len: data.dataList
                        });
                    }
                }, '/api/work/event/getEventConsultList')
                //if (ORDERID && ORDERID != 'undefined') { //orderid返回undefind就不调用这个接口
                ajax({//上部分相片到历史列表
                    type: 'post',
                    data: {
                        eventId:EVENRID,
                    },
                    success: function (res) {
                        console.log(res);
                        me.setState({
                            add: res.data
                        })
                    }
                }, '/api/work/event/getEventReport')//获取报事详情
                if(ORDERID && ORDERID != 'undefined'){
                    ajax({//上部分相片到历史列表
                        type: 'get',
                        data: {
                            orderId:ORDERID,
                            staffId: user.id,
                        },
                        success: function (file) {//工单历史流程
                            me.setState({
                                resList: file.data.eventProcessList
                            })
                        }
                    }, '/api/work/event/getEventReportDetail')//获取工单详情
                } else {
                    me.setState({
                        isShow: true,
                    })
                }
            },
            //componentDidUpdate: function () {
            //},

            render: function () {
                var data = this.state.add,
                    inti = this.state.len,  //1待回复 2回复
                    wait = [],
                    fmt = 'yyyy-MM-dd hh:mm';
                var file = inti && inti.map(function (infn, i) {
                        var Time = lf.utils.format(infn.createTime, fmt);
                        if (infn.status == 1) {
                            return <div key={i} className="priv">
                                        <div className="line undefined"><div className="text-cl line-title">咨询时间：</div><div className="line-content">{Time}</div></div>
                                        <div className="line undefined"><div className="text-cl line-title">咨询内容：</div><div className="line-content">{infn.content}</div></div>
                                   </div>
                        }else if (infn.status == 2) {
                            return <div key={i} className="priv">
                                        <div className="line undefined"><div className="text-cl line-title">回复时间：</div><div className="line-content">{Time}</div></div>
                                        <div className="line undefined"><div className="text-cl line-title">回复内容：</div><div className="line-content">{infn.content}</div></div>
                                   </div>
                        }
                    })
                return (
                    <div className="box-mic">
                        <Add data={data} hi={this.state.isShow}/>
                        <List data={data} resList={this.state.resList}/>

                        <div className="reflex">
                            {file}
                        </div>
                    </div>
                )
            }
        });
    }

    else if (TYPE == FEEDBACK) {//待审核
        var Add = RC({
            getInitialState: function () {
                return ({
                    len: {},
                    add: {},
                    waing: [],
                    largeImgSrc: '',
                    largeImg: '',
                    imgList: [],
                    isShow: false,
                    textFn:'',
                })
            },
            componentWillMount(){
                var me = this,
                    user = me.props.user;
            },
            render: function () {
                var init = this.props.data,
                    pics = [],

                    fmt = 'yyyy-MM-dd hh:mm',
                    orderTime = lf.utils.format(init.orderTime, fmt),
                    reportTime = lf.utils.format(init.reportTime, fmt),
                    me = this;

                if (init.picUrl != undefined)
                    pics = init.picUrl.split(',')

                return (
                    <div className="box-siz">
                        <div className="title-text">工单信息</div>
                        <div className="img-add">
                            <div className="place tp">
                                  <div className="text-cl">任务描述：</div>
                                  <div className="text-rg">{init.content}</div>
                            </div>
                            <div className="place">
                                <Swiper imgList={pics||''} enlargeHandler={me.enlargeHandler}/>
                            </div>
                            <div className="place rep">
                                <div className="text-cl">服务地点：</div>
                                <div className="text-rg">{init.location}</div>
                            </div>
                            <div className="place">
                                <div className="text-cl text-lf">联系人：</div>
                                <div className="text-rg">{init.reporterName}</div>
                            </div>
                            <div className="place">
                                <div className="text-cl">联系电话：</div>
                                <div className="text-rg">{init.phone}</div>
                            </div>
                            <div className="place">
                                <div className="text-cl">预约时间：</div>
                                <div className="text-rg">{orderTime||'无'}</div>
                            </div>
                            <div className="place">
                                <div className="text-cl">报事时间：</div>
                                <div className="text-rg">{reportTime||'无'}</div>
                            </div>
                            <div className="place">
                                <div className="text-cl">反馈内容：</div>
                                <div className="text-rg">{init.result||'无'}</div>
                            </div>
                        </div>
                        <LargeImg src={me.state.largeImgSrc}/>
                    </div>
                )
            },
            enlargeHandler: function(src) {
                this.setState({largeImgSrc: src});
            }
        });
        var List = RC({
            getInitialState: function () {
                return ({
                    menu: '',
                })
            },
            render: function () {
                var infn = this.props.data,
                    resList = this.props.resList,
                    fmt = 'MM-dd hh:mm';
                let list = resList && resList.map(function (info, i) {
                        var Time = lf.utils.format(info.acceptTime, fmt);
                        let arr = info.currAccepterName && info.currAccepterName.split('--');
                        let n = arr && arr.length - 1;
                        var textName;
                        if(resList[i].taskDisplayName == "派单"&& resList[i].status == '1'||resList[i].taskDisplayName == "派单"&& resList[i].status == '2'){
                            textName = '派单中'
                        }else if(resList[i].taskDisplayName == "派单"&& resList[i].status == '3'){
                            textName = '已派单'
                        }else if(resList[i].taskDisplayName == "派工"&& resList[i].status == '0'||resList[i].taskDisplayName == "派工"&& resList[i].status == '1'){
                            textName = '派工中'
                        }else if(resList[i].taskDisplayName == "派工"&& resList[i].status == '2'||resList[i].taskDisplayName == "办理"&& resList[i].status == '2'||resList[i].taskDisplayName == "领导审核"&& resList[i].status == '2'||resList[i].taskDisplayName == "客服回访"&& resList[i].status == '2'){
                            textName = '已退回'
                        }else if(resList[i].taskDisplayName == "派工"&& resList[i].status == '3'){
                            textName = '已派工'
                        }else if(resList[i].taskDisplayName == "办理"&&resList[i].status == '0'||resList[i].taskDisplayName == "办理"&&resList[i].status == '1'){
                            textName = '办理中'
                        }else if(resList[i].taskDisplayName == "办理"&& resList[i].status == '3'){
                            textName = '已办理'
                        }else if(resList[i].taskDisplayName == '领导审核'&&resList[i].status == '0'||resList[i].taskDisplayName == '领导审核'&&resList[i].status == '1'){
                            textName = '领导审核中'
                        }else if(resList[i].taskDisplayName == "领导审核"&& resList[i].status == '3'){
                            textName = '已审核'
                        }else if(resList[i].taskDisplayName == '客服回访'&&resList[i].status == '0'||resList[i].taskDisplayName == '客服回访'&&resList[i].status == '1'){
                            textName = '客服回访中'
                        }else if(resList[i].taskDisplayName == "客服回访"&& resList[i].status == '3'){
                            textName = '已回访'
                        }

                        return <div key={i} className="tpd-row">
                            <p className="tpd-left-con">
                                <i className={resList.length==i+1 ? 'hid':''}></i>
                                <span className="task-processing-name">{arr && arr[n]}</span>
                                <span className="green">{textName}</span>
                            </p>
                            <p>{Time}</p>
                        </div>
                    })
                return (
                    <div className="detail">
                        {list}
                    </div>
                )
            }
        });
        var Body = RC({
            getInitialState: function () {
                return ({
                    len: '',
                    add: '',
                    waing: [],
                    isShow: false,
                    processorList: [],
                    nextOperator: '',
                    nextText: '',
                    resList:'',
                })
            },
            componentWillMount(){
                var me = this,
                    user = me.props.user;
                ajax({//第一级菜单待回复列表下面问题列表(审核列表)
                    type: 'get',
                    data: {
                        eventId: EVENRID,
                    },
                    success: function (data) {
                       //state 1待回复 2回复 有些会返回null
                        me.setState({
                            len: data.dataList
                        });
                    }
                }, '/api/work/event/getEventConsultDetail4Check')

                ajax({//上部分相片到历史列表
                    type: 'post',
                    data: {
                        eventId:EVENRID,
                    },
                    success: function (res) {
                        me.setState({
                            add: res.data
                        })
                    }
                }, '/api/work/event/getEventReport')//获取报事详情
                if(ORDERID && ORDERID != 'undefined'){
                    ajax({//上部分相片到工单历史列表
                        type: 'get',
                        data: {
                            orderId:ORDERID,
                            staffId: user.id,
                        },
                        success: function (file) {//工单历史流程
                            me.setState({
                                resList: file.data.eventProcessList
                            })
                        }
                    }, '/api/work/event/getEventReportDetail')//获取工单详情
                } else {
                    me.setState({
                        isShow: true,
                    })
                }
            },
            componentDidUpdate: function () {
            },
            btnfile: function () {
                var next = this.state.nextOperator;
                if ($('.required').val() == '') {
                    alert('请填写回复内容')
                    return false;
                }
                ajax({
                    type: 'get',
                    data: {
                        eventConsultId: ID,//报事咨询回复ID（主键）就是列表上的id
                        eventId:EVENRID,
                        content: $('.required').val(),//内容
                    },
                    success: function (data) {
                        //if (data.code != '200') return;
                        if(data.code == '200'){
                            if(LAST == 'fn'){
                                alert('发布成功',()=>{
                                    lf.bridgeJs.doClose();
                                });
                            }else{
                                alert('发布成功',()=>{
                                    var FEEDBACK = 'feedback';
                                    lf.bridgeJs.doLocation('report-reply.html?type=' + FEEDBACK, '待审核');
                                });

                            }
                        }else if(data.code == 'EVENTCONSULT_NOT_CHECK'){
                            if(LAST == 'fn'){
                                alert(data.desc,()=>{
                                    lf.bridgeJs.doClose();
                                });
                            }else{
                                alert(data.desc,()=>{
                                    var FEEDBACK = 'feedback';
                                    lf.bridgeJs.doLocation('report-reply.html?type=' + FEEDBACK, '待审核');
                                });
                            }
                        }
                    }
                }, '/api/work/event/checkEventConsult')
            },
            render: function () {
                var data = this.state.add,
                    inti = this.state.len, //1待回复 2回复
                    resList = this.state.resList,
                    fmt = 'yyyy-MM-dd hh:mm',
                    me=this;
                var file = inti && inti.map(function (infn, i) {
                        var Time = lf.utils.format(infn.createTime, fmt);
                        if(i==inti.length-1){
                            $('.required').val(infn.content);
                            me.state.nextText=infn.content
                            return (<div key={i} className="priv">
                                        <div className="line undefined"><div className="text-cl line-title">回复时间：</div><div className="line-content">{Time}</div></div>
                                        <div className="line undefined"><div className="text-cl line-title">回复内容：</div><div className="line-content">{/*infn.content*/}</div></div>
                                   </div>)
                        } else if (infn.status == 1) {
                            return <div key={i} className="priv">
                                        <div className="line undefined"><div className="text-cl line-title">咨询时间：</div><div className="line-content">{Time}</div></div>
                                        <div className="line undefined"><div className="text-cl line-title">咨询内容：</div><div className="line-content">{infn.content}</div></div>
                                   </div>
                        } else if (infn.status == 2) {
                            return <div key={i} className="priv">
                                        <div className="line undefined"><div className="text-cl line-title">回复时间：</div><div className="line-content">{Time}</div></div>
                                        <div className="line undefined"><div className="text-cl line-title">回复内容：</div><div className="line-content">{infn.content}</div></div>
                                   </div>
                        }
                    })
                return (
                    <div className="box-mic">
                        <Add data={data}/>
                        <List data={data} resList={resList}/>
                        <div className="reflex">
                            {file}
                        </div>
                        <div className="text-box">
                            <textarea name="headContext" cols="30" rows="10" className="required"
                                      placeholder="请输入"></textarea>
                        </div>
                        <div className="btn-Submit">
                            <a className="btn-put" href="javascript:;" onClick={this.btnfile}>发布</a>
                        </div>
                    </div>
                )
            }
        });
    }

    lf.bridgeJs.getUser(function (user) {
        r.render(
            <Body user={user}/>,
            document.getElementById('root'), function () {
                $('#root').css('background', '#fff');
            }
        )
    })

})(liefeng, React)

